:root {
    --parchment: #f4e9d8;
    --parchment-dark: #d4c4a8;
    --ink: #2c2416;
    --gold: #c9a961;
    --gold-dark: #9d7d3a;
    --burgundy: #6b2737;
    --selected: rgba(201, 169, 97, 0.3);
    --selected-hover: rgba(201, 169, 97, 0.45);
    --condition-bg: rgba(157, 125, 58, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Crimson Text', serif;
    background-color: var(--parchment);
    color: var(--ink);
    min-height: 100vh;
    line-height: 1.7;
}

.parchment-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(44, 36, 22, 0.015) 2px,
            rgba(44, 36, 22, 0.015) 4px
        );
    pointer-events: none;
    z-index: 1;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: fixed;
    top: 20px;
    left: 20px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--gold);
    color: var(--burgundy);
    text-decoration: none;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.back-button:hover {
    background: var(--gold);
    color: white;
    transform: translateX(-5px);
    box-shadow: 0 4px 15px rgba(201, 169, 97, 0.4);
}

.header {
    text-align: center;
    padding: 80px 20px 40px;
    position: relative;
    z-index: 2;
    border-bottom: 2px solid var(--gold);
    background: linear-gradient(to bottom, var(--parchment) 0%, rgba(201, 169, 97, 0.05) 100%);
}

.ornament {
    font-size: 2.5rem;
    color: var(--gold);
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.7;
}

.ornament-left {
    left: 20px;
}

.ornament-right {
    right: 20px;
}

.title-container {
    max-width: 800px;
    margin: 0 auto;
}

.main-title {
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: 3.5rem;
    color: var(--burgundy);
    letter-spacing: 8px;
    margin-bottom: 10px;
    text-transform: uppercase;
    text-shadow: 2px 2px 0px rgba(201, 169, 97, 0.3);
}

.subtitle {
    font-family: 'Crimson Text', serif;
    font-size: 1.3rem;
    color: var(--gold-dark);
    font-style: italic;
    letter-spacing: 2px;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 40px 20px 80px;
    position: relative;
    z-index: 2;
}

.search-section {
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.6);
    padding: 25px;
    border-radius: 10px;
    border: 2px solid var(--gold);
}

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#searchInput {
    flex: 1;
    padding: 15px 20px;
    font-family: 'Crimson Text', serif;
    font-size: 1.1rem;
    border: 2px solid var(--gold-dark);
    border-radius: 8px;
    background: white;
    color: var(--ink);
    transition: all 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: var(--burgundy);
    box-shadow: 0 0 0 3px rgba(107, 39, 55, 0.1);
}

.clear-btn {
    padding: 15px 20px;
    background: var(--burgundy);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.clear-btn:hover {
    background: #8b3547;
    transform: scale(1.05);
}

/* Contrôles de sélection */
.selection-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding: 15px;
    background: rgba(201, 169, 97, 0.1);
    border-radius: 8px;
    border: 1px solid var(--gold);
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    font-size: 1rem;
}

.checkbox-container input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 24px;
    height: 24px;
    border: 2px solid var(--burgundy);
    border-radius: 4px;
    background: white;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-container input[type="checkbox"]:checked + .checkmark {
    background: var(--burgundy);
    border-color: var(--burgundy);
}

.checkbox-container input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
    font-weight: bold;
}

.label-text {
    color: var(--burgundy);
}

.reset-btn {
    padding: 10px 20px;
    background: var(--gold-dark);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-btn:hover {
    background: var(--burgundy);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 39, 55, 0.3);
}

.results-count {
    text-align: center;
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--burgundy);
    font-weight: 600;
}

.results-count span {
    color: var(--gold-dark);
    font-weight: 700;
}

.results-count {
    text-align: center;
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--burgundy);
    font-weight: 600;
}

.results-count span {
    color: var(--gold-dark);
    font-weight: 700;
}

/* Section de filtres par catégorie */
.filter-section {
    margin-bottom: 15px;
    background: linear-gradient(135deg, rgba(201, 169, 97, 0.08), rgba(107, 39, 55, 0.05));
    padding: 20px;
    border-radius: 10px;
    border: 2px solid var(--gold);
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.filter-header h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: var(--burgundy);
    margin: 0;
    letter-spacing: 1px;
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.toggle-filters-btn {
    padding: 8px 15px;
    background: var(--gold);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-filters-btn:hover {
    background: var(--burgundy);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 39, 55, 0.3);
}

.toggle-filters-btn.active {
    background: var(--burgundy);
}

.clear-filters-btn {
    padding: 8px 15px;
    background: var(--burgundy);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-filters-btn:hover {
    background: #8b3547;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 39, 55, 0.4);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 15px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-category {
    background: white;
    padding: 15px 18px;
    border-radius: 8px;
    border: 2px solid var(--gold);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-category:hover {
    border-color: var(--burgundy);
    box-shadow: 0 2px 10px rgba(107, 39, 55, 0.2);
    transform: translateY(-2px);
}

.filter-category.active {
    background: linear-gradient(135deg, rgba(201, 169, 97, 0.2), rgba(107, 39, 55, 0.1));
    border-color: var(--burgundy);
    border-width: 3px;
}

.filter-category input[type="checkbox"] {
    display: none;
}

.filter-category .filter-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--burgundy);
    border-radius: 4px;
    background: white;
    flex-shrink: 0;
    position: relative;
    transition: all 0.3s ease;
}

.filter-category.active .filter-checkbox {
    background: var(--burgundy);
    border-color: var(--burgundy);
}

.filter-category.active .filter-checkbox::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.filter-category-label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.filter-category-name {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--burgundy);
}

.filter-category-count {
    font-size: 0.9rem;
    color: var(--gold-dark);
    font-style: italic;
}

/* Section talents sélectionnés */
.selected-section {
    margin-bottom: 30px;
    background: linear-gradient(135deg, rgba(107, 39, 55, 0.05), rgba(201, 169, 97, 0.1));
    border: 3px solid var(--burgundy);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 8px 30px rgba(107, 39, 55, 0.2);
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.selected-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--gold);
}

.selected-header h2 {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    color: var(--burgundy);
    letter-spacing: 2px;
    margin: 0;
}

.selected-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.selected-count {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--gold-dark);
    font-weight: 700;
}

.selected-count span {
    color: var(--burgundy);
    font-size: 1.3rem;
}

.selected-total {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--burgundy);
    background: white;
    padding: 8px 15px;
    border-radius: 8px;
    border: 2px solid var(--burgundy);
    box-shadow: 0 2px 8px rgba(107, 39, 55, 0.2);
}

.selected-total span {
    font-size: 1.4rem;
    color: var(--gold-dark);
}

.selected-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 15px;
}

.selected-talent-card {
    background: white;
    border: 2px solid var(--gold);
    border-radius: 8px;
    padding: 15px;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.selected-talent-card:hover {
    border-color: var(--burgundy);
    box-shadow: 0 4px 15px rgba(107, 39, 55, 0.2);
    transform: translateY(-2px);
}

.selected-talent-card::before {
    content: '✕';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    background: var(--burgundy);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.selected-talent-card:hover::before {
    opacity: 1;
}

.selected-talent-name {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--burgundy);
    margin-bottom: 8px;
    padding-right: 30px;
}

.selected-talent-condition {
    font-size: 0.85rem;
    color: var(--gold-dark);
    font-style: italic;
    margin-bottom: 8px;
    padding: 5px 8px;
    background: var(--condition-bg);
    border-radius: 4px;
    border-left: 3px solid var(--gold-dark);
}

.selected-talent-effet {
    font-size: 0.95rem;
    color: var(--ink);
    line-height: 1.5;
    margin-bottom: 8px;
}

.selected-talent-cout {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gold-dark);
    text-align: right;
}

.table-wrapper {
    overflow-x: auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(44, 36, 22, 0.15);
}

.talents-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Crimson Text', serif;
}

.talents-table thead {
    background: linear-gradient(135deg, var(--burgundy), #8b3547);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.talents-table th {
    padding: 18px 15px;
    text-align: left;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.talents-table th:last-child {
    border-right: none;
}

.talents-table tbody tr {
    border-bottom: 1px solid #e0d5c0;
    transition: all 0.2s ease;
}

.talents-table tbody tr:hover {
    background: rgba(201, 169, 97, 0.1);
    transform: scale(1.001);
    box-shadow: 0 2px 8px rgba(44, 36, 22, 0.1);
}

.talents-table tbody tr:nth-child(even) {
    background: rgba(244, 233, 216, 0.3);
}

.talents-table tbody tr:nth-child(even):hover {
    background: rgba(201, 169, 97, 0.15);
}

/* Ligne sélectionnable */
.talents-table tbody tr.selectable {
    cursor: pointer;
}

.talents-table tbody tr.selectable:hover {
    background: rgba(201, 169, 97, 0.2) !important;
}

/* Ligne sélectionnée */
.talents-table tbody tr.selected {
    background: var(--selected) !important;
    border-left: 4px solid var(--burgundy);
}

.talents-table tbody tr.selected:hover {
    background: var(--selected-hover) !important;
}

.talents-table tbody tr.hidden {
    display: none;
}

.talents-table td {
    padding: 15px;
    vertical-align: top;
    font-size: 0.95rem;
    line-height: 1.6;
}

.col-nom {
    width: 18%;
    min-width: 160px;
}

.col-condition {
    width: 20%;
    min-width: 180px;
    background: var(--condition-bg);
}

.col-effet {
    width: 42%;
    min-width: 350px;
}

.col-cout {
    width: 20%;
    min-width: 150px;
    text-align: center;
}

.talent-nom {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    color: var(--burgundy);
    font-size: 1.05rem;
}

.talent-condition {
    color: var(--gold-dark);
    font-style: italic;
    font-size: 0.9rem;
    line-height: 1.5;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    border-left: 3px solid var(--gold-dark);
}

.talent-condition.aucune {
    color: #999;
    font-style: italic;
    border-left: 3px solid #ccc;
}

.talent-effet {
    color: var(--ink);
    line-height: 1.7;
}

.talent-cout {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--burgundy);
    text-align: center;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    border: 2px dashed var(--gold);
    margin-top: 20px;
}

.no-results p {
    font-size: 1.5rem;
    color: var(--burgundy);
    margin-bottom: 10px;
}

.no-results-hint {
    font-size: 1.1rem;
    color: var(--gold-dark);
    font-style: italic;
}

.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.2s ease;
}

.sortable:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sort-icon {
    display: inline-block;
    margin-left: 5px;
    opacity: 0.5;
    font-size: 0.8rem;
}

.sortable.sorted-asc .sort-icon {
    opacity: 1;
}

.sortable.sorted-asc .sort-icon::before {
    content: '▲';
}

.sortable.sorted-desc .sort-icon {
    opacity: 1;
}

.sortable.sorted-desc .sort-icon::before {
    content: '▼';
}

.highlight {
    background-color: #ffeb3b;
    color: #000;
    font-weight: 600;
    padding: 2px 4px;
    border-radius: 3px;
}

.footer {
    text-align: center;
    padding: 40px 20px 30px;
    position: relative;
    z-index: 2;
}

.divider {
    width: 200px;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--gold), transparent);
    margin: 0 auto 20px;
}

.footer p {
    font-size: 0.95rem;
    color: var(--gold-dark);
    letter-spacing: 1px;
}

/* Responsive */
@media (max-width: 1024px) {
    .container {
        padding: 30px 15px 60px;
    }

    .talents-table th,
    .talents-table td {
        padding: 12px 10px;
        font-size: 0.9rem;
    }

    .talent-nom {
        font-size: 1rem;
    }

    .selected-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .back-button {
        top: 10px;
        left: 10px;
        padding: 10px 15px;
        font-size: 0.85rem;
    }

    .header {
        padding: 70px 15px 30px;
    }

    .main-title {
        font-size: 2.5rem;
        letter-spacing: 4px;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    .ornament {
        font-size: 1.8rem;
    }

    .search-section {
        padding: 20px 15px;
    }

    .search-bar {
        flex-direction: column;
    }

    .selection-controls {
        flex-direction: column;
        align-items: stretch;
    }

    #searchInput {
        font-size: 1rem;
        padding: 12px 15px;
    }

    .clear-btn {
        padding: 12px;
    }

    .selected-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .selected-stats {
        flex-direction: column;
        gap: 10px;
    }

    .selected-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .filter-actions {
        flex-direction: column;
    }

    .talents-table thead {
        display: none;
    }

    .talents-table tbody tr {
        display: block;
        margin-bottom: 20px;
        border: 2px solid var(--gold);
        border-radius: 8px;
        padding: 15px;
        background: white;
    }

    .talents-table tbody tr.selected {
        border: 3px solid var(--burgundy);
        background: var(--selected) !important;
    }

    .talents-table td {
        display: block;
        padding: 8px 0;
        border: none;
        background: transparent;
    }

    .talents-table td::before {
        content: attr(data-label);
        font-family: 'Cinzel', serif;
        font-weight: 700;
        color: var(--burgundy);
        display: block;
        margin-bottom: 5px;
    }

    .talent-cout {
        text-align: left;
    }
}